var that = this
const date = new Date()
var that
//时间格式
const formatTime = (date) => {
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  return year+'-'+month+'-'+day;
};
Page({

  /**
   * 页面的初始数据
   */
  data: {
    info:[{
      title:'姓名',
      content:'请输入租客姓名'
    },{
      title:'电话',
      content:'请输入租客电话'
    },{
      title:'姓名',
      content:'请输入租客身份证号'
    },
  ],
  deposithttpWay:[{
    title:'押金',
    content:'元'
  },{
    title:'支付方式',
    content:''
  }
  
],
  index:0,
  paymentMethod:['押一付一','押二付一'],
  rental:[{
    title:'租费',
    content:'',
    events:'',
    index:0,
    id:0,
    columnchange:'',
    range:'',
  },
  {
    title:'月租金',
    content:'元',
    events:'',
    index:0,
    id:1,
    columnchange:'',
    range:'',
  },
  {
    title:'收租周期',
    content:'multiSelector',
    events:'rentalMouthChange',
    index:'rentalMouthIndex',
    id:2,
    columnchange:'rentalMouthColumnChange',
    range:'rentalMouth',
  },{
    title:'初次收租日期',
    content:'date',
    events:'firstRentalChange',
    index:formatTime(date),
    id:3,
    columnchange:'',
    range:'',
  },
  {
    title:'收租期限',
    content:'selector',
    events:'laterDateChange',
    index:'1日',
    id:4,
    columnchange:'',
    range:['1日','2日','3日','4日','5日','6日','7日','8日','9日','10日'],
  }],
  },
  paymentMethodChange(e){
    this.setData({
      index:e.detail.value
    })
  },
 
  firstRentalChange(e){
    var id = e.currentTarget.dataset.id;
    var rental = this.data.rental
    rental[id].index = e.detail.value
    this.setData({
      rental: rental
    })
  },
  laterDateChange(e){
    var id = e.currentTarget.dataset.id;
    var rental = this.data.rental
    rental[id].index = rental[id].range[e.detail.value]
    this.setData({
      rental: rental
    })
  },
  save(){
    wx.navigateBack({
        
    })
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})